
<%
	/**
	 *  list 系统菜单列表
	 * 
	 * @author   李荣华
	 * @version v1.0
	 * @date     2017-11-6
	 * @since   JSP 2.3.1
	 */
%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="at" uri="http://www.jketing.com/at"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>功能列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="no-cache" http-equiv="Pragma" />
<meta content="no-cache" http-equiv="Cache-Control" />
<meta content="0" http-equiv="Expires" />
<meta name="GENERATOR" content="MSHTML 8.00.6001.18854" />
<link rel="stylesheet" id="list" type="text/css" href="<at:url css="list.css"/>" />
<link rel="stylesheet" type="text/css" id="banner" href="<at:url css="banner_button.css"/>" />
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/common.js"></script>
<script type="text/javascript" src="<at:url js="list.js"/>"></script>
<script type="text/javascript" src="<at:url js="banner_button.js"/>"></script>
<script type="text/javascript">
	/**
	 * 跳转到添加页面
	 */
	function add() {
		if ("3" == '${nodeType}') {
			alert('功能节点不能加下级！');
		} else {
			var url = "${pageContext.request.contextPath }/function?nodeType=${nodeType}&order=${order}&parent.id=${query.parent.id}";
			setTimeout(function() {
				window.location.href = url;
			}, 0);
		}
	}

	/**
	 * 点击名称跳到编辑页
	 */
	function enter(id) {
		var url = "${pageContext.request.contextPath}/function/" + id;
		if (id) {
			if (id != '1') {
				alert(url);
				$("#_form").attr("action", url);
				$("#_form").submit();
			} else {
				alert('不能修改根节点！');
			}
		}
	}

	/**
	 * 跳转到编辑页面
	 */
	function edit() {
		var id = checkOneValue('checkOne');
		var url = "${pageContext.request.contextPath}/function/";
		if (id) {
			if (id != '1') {
				url += id;
				alert(url);
				$("#_form").attr("action", url);
				$("#_form").submit();
			} else {
				alert('不能修改根节点！');
			}
		}
	}

	/**
	 * 删除操作
	 */
	function del() {
		var id = checkManyValue('checkOne');
		if (id && window.confirm("你确定要删除吗？")) {
			var url = "${pageContext.request.contextPath }/function/" + ids;
			$("#_form").attr("action", url);
			$("#_method").val("DELETE");
			$("#_form").submit();
		}
	}
	
	/**
	 * frame内部的数据列表上的查询按钮调用
	 * 
	 * @return
	 */
	function queryBar() {	
		var bar = document.getElementById("query_bar");
		var header = document.getElementById("dataheader");
		var list = document.getElementById("dataList");
		if (bar.style.display == "none") {
			bar.style.display = "block";
			bar.style.top="24px";
			bar.style.height="30px";
			header.style.top="54px";
			list.style.top="78px";
		} else {
			bar.style.display = "none";				
			bar.style.top="0px";
			bar.style.height="0px";				
			header.style.top="24px";
			list.style.top="48px";
		}	
	}

	/**
	 * 页面初始化
	 */
	$(document).ready(function() {
		<c:if test="${type!=null}">
			parent.refreshNode(); 
		</c:if>
	});
</script>
</head>
<body style="margin: 0px;">
	<form action="${pageContext.request.contextPath}/function/list?flag=list"
		id="_form" name="queryForm" method="post">
		<input type="hidden" id="_method" name="_method"/>
		<input type="hidden" name="parent.id" value="${query.parent.id}" /> 
		<input type="hidden" name="nodeType" value="${nodeType}" /> 
		<input type="hidden" name="page" value="${page}" /> 
		<input type="hidden" name="order" value="${order}" /> 
		<input type="hidden" name="vQuery" value="${vQuery}" />
		<!-- 按钮行表单 -->
		<div class="list1_f">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" >
				<tr>
					<td width="5" height="24" id="kjz03"></td>
					<td class="biao1_zhong" valign="middle">
						<table width="100%" border="0" cellspacing="0"
							cellpadding="0">
							<tr>
								<td height="24">
									<jsp:include page="../../ListHead.jsp" flush="true">
										<jsp:param name="delUrl"
											value="${pageContext.request.contextPath }/function/" />
									</jsp:include>
								</td>
							</tr>
						</table>
					</td>
					<td width="5" height="24" id="kjy03"></td>
				</tr>
			</table>
		</div>
		<!-- 查询条件（默认不显示） -->
		<div id="query_bar" style="display:${vQuery==0?'none':'block'};" class="queryTab_f">
			<div>名称:<input type="text" name="name" value="${query.name}" /></div>
			<div>功能:
				<select class="select" name="type">
					<option value="">所有</option>
					<option value="2" selected="${query.funType==2?'selected':''}">菜单</option>
					<option value="3" selected="${query.funType==3?'selected':''}">功能</option>
				</select>
			</div>
			<div>请求:<input type="text" name="url" value="${query.url}" /></div>
			<div>
				<ul>
					<li class="biao5_zhong">
						<a href="#" onclick="document.forms['queryForm'].page.value=1;document.queryForm.submit();">提交</a>
					</li>
				</ul>
			</div>
		</div>	
		<!-- 标题 -->
		<div id="dataheader" class="list2_f">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr class="cur">
					<td width="3%" align="center">
						<input type='checkbox' onclick="selectReverse('checkOne')" id="ID" value=''/>
					</td>
					<td width="10%" align="left" onclick="orderby('name')">名称</td>
					<td width="15%" align="left" onclick="orderby('funType')">类型</td>
					<td width="15%" align="left" onclick="orderby('url')">请求</td>
					<td width="15%" align="left" onclick="orderby('useable')">状态</td>
					<td width="25%" align="left" onclick="orderby('remark')">备注</td>
				</tr>
			</table>
		</div>
		<!-- 表体  -->
		<div id="dataList" class="list3_f">
			<c:forEach items="${pageBean.content}" var="item" varStatus="status">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr id="tr${status.count}" onclick="rowclick(this)">
						<td>
							<table width="100%" border="0" cellspacing="0"
								cellpadding="0">
								<tr id="tr${status.count}" onclick="rowclick(this)" class="list_table_tr">
									<td width="3%" align="center" height="24">
									<input id="checkOne" name="checkOne" value="${item.id}" 
									type='checkbox' onclick="dataPageCheckChange(this)" /></td>
									<td width="10%" align="left" title="${item.id}">
										<nobr><a href="###" onclick="enter('${item.id}');">${item.name}</a></nobr>
									</td>
									<td width="15%" align="left" title="${item.funType==2?'菜单':'功能'}">
											${item.funType==2?'菜单':'功能'}
									</td>	
									<td width="15%" align="left" title="${item.url}">${item.url}</td>
									<td width="15%" align="left" title="${item.useable == 'true'?'使用':'保留'}">
										${item.useable == 'true'?'使用':'保留'}
									</td>
									<td width="25%" align="left" title="${item.remark}">${item.remark}</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</c:forEach>
		</div>
		<!-- 页码 --> 
		<div class="list4_f">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr valign="top">
								<td width="4" height="24" id="kj2z03" valign="bottom"></td>
								<td class="biao4_zhong" valign="bottom">
									<table width="100%" border="0" cellspacing="0"
										cellpadding="0">
										<tr>
											<td valign="bottom">
												<table align="right">
													<tr>
														<at:page />
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
								<td width="4" height="24" id="kj2y03" valign="bottom"></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</div>
	</form>
</body>
</html>
